<html>
<body>
Welcome  <?php echo $_POST['studentname']; ?> </br>

<?php
     
    
    require "config.php";
    $con = mysql_connect("localhost",$db_user,$db_pass);
    if (!$con){
		die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name,$con);
    $sql_fetch = "SELECT * FROM COURSE;";
    $result=mysql_query($sql_fetch);
    
    echo " List of courses"."<br/>";
    
    $output=array();
    while($row = mysql_fetch_array($result)){
            
            echo $row['coursename']."<br/>";
            $output[]=$row['coursename'];
            
        }
    $course_selected = strtolower ($_POST['coursename1']);
    
    if (in_array($course_selected,$output)){
        echo "Course is available"."<br/>";
    }
    else {
        echo " The course is not available / Invalid input "."<br/>";
    }
    
    echo "Yippe..!!!!!!";
    
    mysql_close($con);

  
    ?>

</body>
</html>

